package com.jf.listener;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-09-02
 * Time:0:23
 */
@WebListener
public class JFHttpSessionAttributeListener implements HttpSessionAttributeListener {
    @Override
    public void attributeAdded(HttpSessionBindingEvent httpSessionBindingEvent) {
        System.out.println("===================================================================================");
        System.out.println("session add " + httpSessionBindingEvent.getName() + " - " + httpSessionBindingEvent.getValue());
        System.out.println("===================================================================================");
    }

    @Override
    public void attributeRemoved(HttpSessionBindingEvent httpSessionBindingEvent) {
        System.out.println("===================================================================================");
        System.out.println("session removed " + httpSessionBindingEvent.getName() + " - " + httpSessionBindingEvent.getValue());
        System.out.println("===================================================================================");
    }

    @Override
    public void attributeReplaced(HttpSessionBindingEvent httpSessionBindingEvent) {
        System.out.println("===================================================================================");
        System.out.println("session replaced " + httpSessionBindingEvent.getName() + " - " + httpSessionBindingEvent.getValue());
        System.out.println("===================================================================================");
    }
}
